<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/common/jsp/taglibs-nojs-nocss.jsp"%>
<%@include file="/common/jsp/cssAndScript.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<base href="<%=basePath%>"/>
<%@include file="/pages/head.jsp"%>
<div id="main_container">
  <div id="container_border">
        <div class="window_1">
        	<div id="assistFee_div">
            	<h3 class="priceRulelist_title_pic_2">用户管理列表</h3>
        		<a class="btn_box btn_file_icon2"  href="javascript:void(0)" onclick="showDialog('用户新建','userManager/initAddUser.action',600,400)">新建</a>
        	</div>
        </div>
    <div class="window_bottom">
		<div id="pricerulemanage" style="height:450px;">         
            <table width="100%" border="0" cellpadding="0"  cellspacing="0" class="gridview"  id="pricerule_table">
                <thead>
                <tr class="title">
                    <td style="width: 150px;">id</td>
                    <td >登陆名称</td>
                    <td >中文名称</td>
                    <td >用户状态</td>
                    <td >所属部门</td>
                    <td >包含角色</td>
                    <td >操作</td>
                </tr>
                </thead>
                <tbody class="mytbody">
                	<s:if test="userList.size()==0">
                		<tr>
                			<td colspan="2" align="center">无记录</td>
                		</tr>
                	</s:if><s:else>
		                <s:iterator value="userList" status="stat">
			                <tr>
			                    <td><s:property value="#stat.count"/></td>
			                    <td ><s:property value="name"/></td>
			                    <td ><s:property value="cname"/></td>
			                    <td>
				                    <s:if test="status==1">
				                    	正常
				                    </s:if>
				                    <s:else>
				                    	禁用
				                    </s:else>
			                    </td>
			                    <td><s:property value="department.name"/></td>
			                    <td >
			                    	<s:iterator value="roles" status="stat">
			                    		<s:property value="role.cname"/>
			                    	</s:iterator>
			                    </td>
			                    <td>
			                    	<s:if test="name!='admin'">
			                    	 	<a href="javascript:void(0)" onclick="showDialog('编辑用户','userManager/initAddUser.action?user.id=<s:property value="id"/>',500,400)">修改</a>
				                    	<s:if test="status==1">
				                    		<a href="javascript:void(0)" onclick="confirmDelUser('<s:property value="id"/>',0,'禁用');">禁用</a>
					                    </s:if>
					                    <s:else>
					                    	<a href="javascript:void(0)" onclick="confirmDelUser('<s:property value="id"/>',1,'激活');">激活</a>
					                    </s:else>
					                    <a href="javascript:void(0)" onclick="resetPassword('<s:property value="id"/>','<s:property value="cname"/>');">重置密码</a>
			                    	</s:if>
			                    </td>
			                </tr>
		                </s:iterator>
                	</s:else>
                </tbody>
           </table>
        </div> 
    </div>
    </div>
    </div>
 <script type="text/javascript">
<!--
function confirmDelUser(id,status,name){
	if(window.confirm("确定"+name+"此用户吗？")){
		location.href = "<%=basePath%>userManager/stopUser.action?user.status="+status+"&user.id="+id;
			//window.location.href = "<%=basePath%>userManager/deleteUser.action?user.id="+id;
	}
}

function resetPassword(id,name){
	if(window.confirm("确定要对 "+name+" 进行密码重新初始化吗？")){
		location.href = "<%=basePath%>userManager/resetPassword.action?user.id="+id;
	}
}
//-->
</script>
